<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改失效日期菜单')"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>

</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-invalidDate-edit" th:object="${companysRegisters}">
        <div class="form-group">
            <label class="col-sm-3 control-label">选择公司：</label>
            <div class="col-sm-8">
                <select id="ids" name="ids" class="form-control select2-multiple" multiple>
                    <option th:each="companysRegisters:${companysRegisters}" th:value="${companysRegisters.id }"
                            th:text="${companysRegisters.title }" selected></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">失效时间：</label>
            <div class="col-sm-8">
                <input name="effectDate" id="effectDate" class="form-control" type="text" required>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script type="text/javascript">
    var prefix = ctx + "company/admin";

    $(function () {
        $("#effectDate").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    });


    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-invalidDate-edit").serializeArray();
            var ids = $("#ids").val();
            var effectDate = $("#effectDate").val();
            data.push({"id": "ids", "value": ids});
            data.push({"id": "effectDate", "value": effectDate});
            $.operate.save(prefix + "/editInvalidDate", data);
        }
    }

</script>
</body>
</html>
